import http from '@/utils/request/index'

const state = {
	courseList: [],
}
const getters = {
	courseList: state => state.courseList,
}

const actions = {
	// 获取模板数据
	async getCourseListByPage({
		commit
	}, options) {
		const { status, data: { list } } = await http('course.list', {
      pageNum: 1,
      pageSize: 100,
      ...options,
    });

		if (status === 200 && list.length > 0) {
			commit("setCourseList", list);
		}
	},
}


const mutations = {
	setCourseList(state, courseList) {
    // console.log(courseList)
		state.courseList = courseList;
	}
}


export default {
	state,
	mutations,
	actions,
	getters
}
